package io.renren.modules.reception.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.modules.reception.entity.vo.CheckoutVo;
import io.renren.modules.reception.entity.vo.CountTotalVo;
import io.renren.modules.reception.entity.vo.TangShiOrderRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.reception.dao.TStoreOrderRecordDao;
import io.renren.modules.reception.entity.TStoreOrderRecordEntity;
import io.renren.modules.reception.service.TStoreOrderRecordService;

import javax.annotation.Resource;


@Service("tStoreOrderRecordService")
public class TStoreOrderRecordServiceImpl extends ServiceImpl<TStoreOrderRecordDao, TStoreOrderRecordEntity> implements TStoreOrderRecordService {

    @Autowired
    private TStoreOrderRecordDao storeOrderRecordDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TStoreOrderRecordEntity> page = this.page(
                new Query<TStoreOrderRecordEntity>().getPage(params),
                new QueryWrapper<TStoreOrderRecordEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public Page<TangShiOrderRecordVo> listOrderRecord(Map<String, Object> params) {
        Page<TangShiOrderRecordVo> page = new Page<TangShiOrderRecordVo>
                (Long.parseLong((String) params.get("current")),Long.parseLong((String) params.get("size")));
        return storeOrderRecordDao.listOrderRecord(page,params);
    }

    @Override
    public List<CountTotalVo> sumReallyGet(Map<String, Object> map) {
        return storeOrderRecordDao.sumReallyGet(map);
    }

}